package org.example.service.impl;

import org.example.dao.ResourcesDao;
import org.example.service.LogService;
import org.example.service.ResourcesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class ResourcesServicelmpl implements ResourcesService {

    @Autowired
    private ResourcesDao resourcesDao;

    @Autowired
    private LogService logService;

    @Override
    public void transfer(Integer outId,Integer inId ,Integer moeny) {
        try{
            resourcesDao.outMoney(outId,moeny);
//            int i = 1/0;
            resourcesDao.inMoney(inId,moeny);
        }finally {
            logService.log(outId,inId,moeny,"成功");
        }
    }
}
